<%@page import="siteflash.helper.StringHelper"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.util.ArrayList"%>
<%@page import="siteflash.model.Game" %>

<%
    String title = (String) request.getAttribute("title");
    String description = (String) request.getAttribute("description");
    String keywords = (String) request.getAttribute("keyword");
    
    Game game = (Game) request.getAttribute("game");
    ArrayList<String> tags = (ArrayList<String>) game.getTags();
    DateFormat sortformat = new SimpleDateFormat("dd-MM-yyyy");
%>
<jsp:include page="/layouts/header.jsp">
    <jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="keywords" value="<%=keywords %>" />
    <jsp:param name="page" value="home" />
    <jsp:param name="ogtitle" value="<%=game.getName()%>" />
    <jsp:param name="ogimage" value="<%=game.getImageThumb().getValue() %>" />
    <jsp:param name="ogescription" value="<%=game.getDescription().getValue() %>" />
</jsp:include>

<script type="text/javascript">
jQuery(document).ready(function () {
    jQuery('#flash').flash({
         'width':'640',
         'height':'480',
         'allowfullscreen':'true',
         'allowscriptaccess':'always'
    });
});
</script>
        <div class="infopage">
           <div class="topinfo">
                <div class="tleft">
                    <h1><%=game.getName()%></h1> <span class="desc">Size: 21.1 MB. This game has submitted <%=sortformat.format(game.getCreated()) %>. It played <%=game.getPlayed()%> times</span>
                    <div class="tags">
                        <% for(int i = 0; i < tags.size(); i++) { %>
                        <a href="/tags/<%=StringHelper.replace(tags.get(i)) %>"><%=tags.get(i) %></a>
                        <% } %>
                    </div>
                </div>
                <div class="back">
                    <a href="javascript:history.go(-1)" ><img src="/images/back.png" alt="" /></a>
                    <a href="javascript:history.go(-1)" class="back" >Back</a>
                    <div class="clear"></div>
                </div>
                <div class="clear"></div>
           </div>
           
           <div class="playinfo">
                <div class="help">If the game freezes, just click inside it (games can get unresponsive if you click elsewhere on the page).</div>
                <% if (game.getType().getValue().equalsIgnoreCase("external")) { %>
                <div style="width: auto; text-align: center">
					<a target="_blank" href="<%=game.getUrl().getValue()%>">
					<img class="external_game" src="<%=game.getFlash().getValue() %>" alt="<%=game.getName()%>" />
					</a>
		        </div>
                <% } else { %>
                <div class="object">
                    <a id="flash" href="<%=game.getFlash().getValue() %>">Javascript disabled! Click here for video.</a>
                </div>
                <div class="fullsize">
                  <a href="<%=game.getFlash().getValue() %>">
                  Play this game in the size of your screen or download it
                  </a>
                </div>
                <% } %>
           </div>
           
           <div class="gameinfo">
                <table cellpadding="0" cellspacing="0">
                    <tr>
                        <td class="first">
                            <label>Game description: </label><%=game.getDescription().getValue() %>
                        </td>
                        <td class="end">
                            <label>Game controls: </label><%=game.getControls().getValue() %>
                        </td>
                    </tr>
                </table>
           </div>
           
           <div class="otherinfo">
                <table cellpadding="0" cellspacing="0" width="100%">
                  <tr>
                      <td class="vote">
                      <h2>Tags:</h2>
                         <% for (int i = 0; i < game.getTagSeo().size(); i++) { %>
                         <a><%=game.getTagSeo().get(i) %></a>
                         <% } %>
                      </td>
                      <td class="addthis">
                        
                        <h2>Share</h2>
                        <!-- AddThis Button BEGIN -->
						<div class="addthis_toolbox addthis_default_style ">
						<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
						<a class="addthis_button_tweet" tw:via="y1s.org"></a>
						<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
						<a class="addthis_counter addthis_pill_style"></a>
						</div>
						<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f4f217074402877"></script>
						<!-- AddThis Button END -->
                      </td>
                  </tr>
              </table>
           </div>
       </div>
<jsp:include page="/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>